


<html lang="en">
   <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta name="google-site-verification" content="0oc9Wnx2Qtw4w0xOtMUCUMfAAL7oviEZVjxqwLQo7AY" />
      <META NAME="Description" CONTENT="Twitter Instant Search!  Search Twitter instantly with endless search results.">
      <title>Twitter Instant Search | TwitStant</title>
      <link rel="canonical" href="http://www.twitstant.com" />
<meta http-equiv="content-script-type" content="text/javascript">


 <style type="text/css">
   .addThisContainer { margin-left: auto;
    margin-right: auto;width:500px;margin-top:5px;}


.trendTopic {font-size:11.5px;font-family:arial;text-transform:lowercase;}


#footer {
width:600px;

position: fixed;
bottom: 0px;height:30px;
background: #59b;
text-align: center;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
visibility:hidden;

}

  </style>


<!--[if lte IE 7]>
<script>
location.href='ie6.html';
window.event.returnValue=false;
</script>
<![endif]-->


 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
 <script src="jquery.tmpl.js"></script>
 <script src="http://platform.twitter.com/anywhere.js?id=NCiAZz2xboctsJVAXvABnQ&amp;v=1"></script>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

<script>

  var myWidth = 0;

  function setWidth() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //not ie
    myWidth = window.innerWidth;

  } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
    //IE 6+ 
    myWidth = document.documentElement.clientWidth;
  
  } else if( document.body && ( document.body.clientWidth ) ) {
    //IE 4 
    myWidth = document.body.clientWidth;

  }
 var halfWidth = (myWidth -400) / 2;
 var trendsHalfWidth = (myWidth - 1200) / 2;
 var footerHalfWidth = (myWidth - 600) / 2;

$('#headersearch').css('margin-left',halfWidth + 'px');
$('#headersearch').css('margin-right',halfWidth + 'px');
$('#footer').css('margin-left',footerHalfWidth + 'px');
$('#footer').css('margin-right',footerHalfWidth + 'px');

   $('#headersearch').css('visibility','visible');
 $('#footer').css('visibility','visible');
 
setTrends();

$('#alltrends').css('margin-left',trendsHalfWidth + 'px');
$('#alltrends').css('margin-right',trendsHalfWidth + 'px');

   $('#alltrends').css('visibility','visible');
$("#searchbox").focus();


 }

function getLongUrl(obj) {
   return obj['long-url'];
}

function clearPreview() {
  $("#screenshot").remove();
}

function showPreview(e, shortUrl,  timestamp) {
       

             expandedUrlRequest = 'http://www.twitstant.com/lengthen?&url=' + shortUrl + '&format=json&callback=?';


             $.getJSON(expandedUrlRequest, function(expanded) {
          
                    if (timestamp != lastHoverUrlTime) {
                           	$("#screenshot").remove();
                           return true;
                    } else if (shortUrl != lastHoverUrl) {
                           	$("#screenshot").remove();
                           return true;
                    }
          
                      
                  var longUrl = getLongUrl(expanded); 
                 

                  if (longUrl.length > 40) {
                           var c = (longUrl != "") ? "<br/>" + escape(longUrl).substring(0,40)+'...' : "";
                  } else {
                         var c = (longUrl != "") ? "<br/>" + escape(longUrl) : "";
                  }

                 var thisWind = $(window);
                var gap= thisWind.height() - (e.pageY - thisWind.scrollTop() + 250);
           
                if (gap < 0) {
                       thisYOffSet = gap * -1;
                }  else {
                       thisYOffSet =  yOffset;
                } 
             
               
                $("#screenshot").remove();

                 thumbUrl = 'http://www.twitstant.com/preview?url=' + shortUrl;
		$("body").append("<p id='screenshot'><img src='"+ thumbUrl +"'alt='url preview' />"+ unescape(c) +"</p>");			
		 
		$("#screenshot")
			.css("top",(e.pageY - thisYOffSet) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.fadeIn("fast"); 
                });					
}

var lastHoverUrlTime = 0;
var lastHoverUrl;
function screenshotPreview() {	
		
		yOffset = 5;
		xOffset = 25;
		
	$("a.screenshot").hoverIntent(function(e) {
		this.t = "";
		this.title = "";	
		lastHoverUrlTime = e.timeStamp;
                lastHoverUrl =  this.rel;

  
              

                showPreview(e, this.rel,  lastHoverUrlTime);

              			
    },
	function(){ 
		this.title = this.t;	
		$("#screenshot").remove();
    });	 
	$("a.screenshot").mousemove(function(e){

                  var thisWind = $(window);
                var gap= thisWind.height() - (e.pageY - thisWind.scrollTop() + 250);
           
                if (gap < 0) {
                       thisYOffSet = gap * -1;
                }  else {
                       thisYOffSet =  yOffset;
                } 
             

		$("#screenshot")
			.css("top",(e.pageY - thisYOffSet) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};


 function relative_time(time_value) {
    var values = time_value.split(" ");
    time_value = values[2] + " " + values[1] + ", " + values[3] + " " + values[4];

    var parsed_date = Date.parse(time_value);
    var relative_to = (arguments.length > 1) ? arguments[1] : new Date();

    var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
    delta = delta + (relative_to.getTimezoneOffset() * 60);

    if (delta < 60) {
	return 'less than a minute ago';
    } else if(delta < 120) {
	return 'about a minute ago';
    } else if(delta < (60*60)) {
	return (parseInt(delta / 60)).toString() + ' minutes ago';
    } else if(delta < (120*60)) {
	return 'about an hour ago';
    } else if(delta < (24*60*60)) {
	return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
    } else if(delta < (48*60*60)) {
	return '1 day ago';
    } else {
	return (parseInt(delta / 86400)).toString() + ' days ago';
    }
}

function hyperlink(tweet) { 

  reg = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
 
  m = tweet.match(reg);


  if (m != null) {
     tweet.replace(m[0],m[0] + "title=\"longtitle\" ");
  } 


  tweet = tweet.replace( /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,"<a href=\"$1\" target=\"_blank\" onmouseup=\"clearPreview();\" class=\"screenshot\" rel=\"$1\">$1</a>" );

 // tweet = tweet.replace(/(^|\s)(@\w+)/gm, '$1<a href="http://twitter.com/$2" target=\"_blank\" rel=\"nofollow\">$2</a>');

  tweet = tweet.replace(/(^|\s)(#\w+)/gm, '$1<a href="#" onclick=\"searchHash(\'$2\');\">$2</a>');

 return tweet;

}

function getNewTweets() {

    pageNo = pageLastCompletedSearch + 1;
   

    if (searchType == 'trend') {
        searchArgs = 'search.json?rpp=50&page=' + pageNo + '&q=';    
        searchUrl = currentTrendsUnmodifiedSearch.replace("search/",searchArgs);
        //3
        twitterSearch(searchUrl, pageNo);
    } else if (searchType == 'user') {
         searchArgs = 'search.json?rpp=50&page=' + pageNo + '&';    

       searchUrl = userSearchQuery.replace("search.json?",searchArgs);
//4
       twitterSearch(searchUrl, pageNo);
    }
   
}

reloadEnabled = true;

// reload tweets on scrolling to bottom
function addReadLastTweetHandler() {
  if (reloadEnabled == false) {
    return;
  }

var doc = $(document);
var wind = $(window);

doc.scroll(function(){ 

  toTop = wind.scrollTop();
  scrolled = doc.height() - wind.height();
  
  if (toTop == scrolled) {
       if (reloadEnabled) {
         reloadEnabled = false;
         getNewTweets();
       }
  }
 
  
});

}
//1


function twitterSearch(searchUrl,pageNo) {

     $.ajax({
              type : 'GET',
              dataType : 'jsonp',
              url : searchUrl,
              success : function(tweets) {    
                   pageLastCompletedSearch = pageNo;
                   reloadEnabled = true;   
                   var search = $.map(tweets.results, function(obj, index) { 
                         return {
                              tweeter : obj.from_user,
                              tweet : hyperlink(obj.text),
                              tweetID: obj.id_str,
                              tweettime: relative_time(obj.created_at),
                              imgSource : obj.profile_image_url
                         };
                   });
                   $('#tweets').tmpl(search).appendTo('#twitter'); 
                   screenshotPreview();
                  twttr.anywhere(function(twitter) {
                     twitter.hovercards();
                    });
              }
     });
      
      
}


var searchType;
var curPage;
var pageLastCompletedSearch;
var currentTrendsUnmodifiedSearch;

function searchHash(passedInQuery) {

   userSearchQuery = 'http://search.twitter.com/search.json?q=' + escape(passedInQuery);
        searchArgs = 'search.json?rpp=30&page=' + 1 + '&';
        searchUrl = userSearchQuery.replace("search.json?",searchArgs);
       searchTrend(searchUrl,1,true)

}

 function searchTrend(searchUrl,pageNo,emptyExistingTweets) {

      //  $('#footer').css('visibility','hidden');
        $('#noresults').css('visibility','hidden');

        if (emptyExistingTweets) {
             $('#twitter').empty();  
        }
        searchArgs = 'search.json?rpp=30&page=' + pageNo + '&q=';
 
        currentTrendsUnmodifiedSearch = searchUrl;                  
        searchUrl = searchUrl.replace("search/",searchArgs);

        searchType = 'trend';
        curPage = pageNo;
	//2
        twitterSearch(searchUrl,pageNo);

         $.ajax({
            type : 'GET',
            dataType : 'jsonp',
            url : searchUrl,

            success : function(tweets) { 
            pageLastCompletedSearch = pageNo;
             reloadEnabled = true;
           var search = $.map(tweets.results, function(obj, index) { 
                  return {
                     tweeter : obj.from_user,
                     tweet : hyperlink(obj.text),
                     tweetID: obj.id_str,
                     tweettime: relative_time(obj.created_at),
                     imgSource : obj.profile_image_url,
                  };
               });


               $('#tweets').tmpl(search).appendTo('#twitter');

               if (tweets.results.length == 0) {
                    $('#noresults').css('visibility','visible');
               } else {
               //    $('#footer').css('visibility','visible');
               }
 screenshotPreview();
 addReadLastTweetHandler();
               
               
            }
      });

 }

 var userSearchQuery;
 function search(searchQuery, searchTime) {

        searchType = 'user';
        pageNo = 1;

      //  $('#footer').css('visibility','hidden');
        $('#noresults').css('visibility','hidden');
        $('#twitter').empty();  
 
        userSearchQuery = 'http://search.twitter.com/search.json?q=' + escape(searchQuery);
        searchArgs = 'search.json?rpp=30&page=' + pageNo + '&';
        searchUrl = userSearchQuery.replace("search.json?",searchArgs);
          //3
         $.ajax({
            type : 'GET',
            dataType : 'jsonp',
            url : searchUrl,

            success : function(tweets) { 
              if (timeLastPress != searchTime) { 
                   return;
              }
              pageLastCompletedSearch = pageNo;
              reloadEnabled = true;
              userSearchQuery = 'http://search.twitter.com/search.json?q=' + escape(searchQuery);
               
               var twitter = $.map(tweets.results, function(obj, index) {
                  return { 
                     tweeter : obj.from_user,
                     tweet : hyperlink(obj.text),
                     tweetID: obj.id_str,
                     tweettime: relative_time(obj.created_at),
                     imgSource : obj.profile_image_url,
                  };
               });


               $('#tweets').tmpl(twitter).appendTo('#twitter');

               if (tweets.results.length == 0) {
                    $('#noresults').css('visibility','visible');
               } else {
              //     $('#footer').css('visibility','visible');
               }
screenshotPreview();
 addReadLastTweetHandler();
twttr.anywhere(function(twitter) {
              twitter.hovercards();
     });
               
               
            }
      });
   }

function setTrends() {
//4
       $.ajax({
            type : 'GET',
            dataType : 'jsonp',
            url : 'http://api.twitter.com/1/trends/1.json?exclude=hashtags',

            success : function(trends) { 
                
     
         

               var trends = $.map(trends[0].trends, function(obj, index) { 
              
                  return { 
                     trend : obj.name,
                     trendUrl : obj.url,
                     fontSize: '12px'
                  };
               });
                $('#trends').tmpl(trends).appendTo('#trend');
                $('#fb').css('visibility','visible');
                $('#tweetbutton').css('visibility','visible');
            }
      });
   }

(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);


</script>

<style>
body {
 font-family: helvetica, arial,sans-serif;
 font-size: 12.5px;
 background: #59b url('twitstantbg.png') repeat-x;
}
 
li {
   
background:white;
border: 1px solid #456;
overflow: hidden;
padding:10px;padding-top:15px;
padding-bottom: 5px;
-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;
color: #333333;
color: rgb(51, 51, 51);
list-style-type:none;
font-family: "lucida grande",lucida,tahoma,helvetica,arial,sans-serif;
font-size: 13px;
line-height: 1.38em;
vertical-align: baseline;
letter-spacing: normal;
word-spacing: 0px;
font-weight: normal;
font-style: normal;
font-variant: normal;
text-transform: none;
text-decoration: none;
text-align: left;
text-indent: 0px;



}

li a {display:inline;text-decoration:none;
      font-weight:bold;
      color:rgb(34, 118, 187);
      font-size:14px;}

#tweet {margin-top:0px;margin-bottom:5px;display:inline;}
 
img {
 float: left;
 margin-right: 8px;padding-bottom:1em;
 width:60px;
}
 
p.tweeter {display:inline;}
p:first-letter {font-size:100px;}

.tweetFooter {display:block;}

.tweettime { 
   margin-top: 0;color:#123123; font-size:10px; color:#aaa;font-weight:bold;display:inline;
}

.twitterActions {display:inline;}
.twitterAction {display:inline;}
.twitterAction a { 
   margin-top: 0;color:#4cf; font-size:10px;font-weight:bold;
}
 
#headerContaier {width:800px;}
#headersearch { height:50px;width:380px;;visibility:hidden; overflow:hidden;text-overflow:hidden;}
#headersearch img {width:200px; }
 
ul { padding: 0;}

.alltweets {margin:auto;width:550px;}

.searchbox {margin-top:15px;padding:4px 4px;
           border:1px solid #eee;
           -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;
           font-family:"Lucida Grande",Arial,Sans-serif;
background:#fff;
}

.searchbox:hover {background:#eefeef;}

#twitter {width:550px;}


.noresults {visibility:hidden;margin:auto;text-align:center;}

#alltrends {
margin:auto;text-align:center;
width:1200px;
visibility:hidden;
padding-bottom:10px;overflow:hidden;text-overflow:hidden;
}

#trend li {
 width:10px;
 display:inline;
 border:none;margin:0px;padding:6px;
 background:transparent;
}
#trend li a {
  color: #333456;font-weight:normal;
}

.tweet a {font-weight:normal;font-family: "lucida grande",lucida,tahoma,helvetica,arial,sans-serif;
font-size: 13px;
line-height: 1.38em;
vertical-align: baseline;
letter-spacing: normal;
word-spacing: 0px;
font-weight: normal;
font-style: normal;
font-variant: normal;
text-transform: none;
text-decoration: none;
text-align: left;
text-indent: 0px;

} 

#trend {display:inline;}
#tweetbutton {width:15;display:inline; visibility:hidden;padding-left:10px;vertical-align:top;}
#fb {width:15;display:inline; visibility:hidden;padding-left:10px;vertical-align:top;}

#screenshot{

position:absolute; 

border:1px solid #ccc;

background:#333;

padding:5px;

display:none;

color:#fff;

}

#screenshot img{ width:270px;}


</style>



 <script>

 var timeLastPress;
$(function() 
    {
      $("#searchbox").keyup(function(event)  {  

       // ignore shift, arrows keys
       if ((event.which == 16) || (event.which >= 36 && event.which <=40)) {
           return;
       }

        char= String.fromCharCode(event.which);	
        searchQuery = $("#searchbox").val();
	timeLastPress = event.timeStamp;
         search(searchQuery, timeLastPress);  
            
      });
   });


</script>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19148896-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
 
<body onload="setWidth();">






       <script id="trends" type="text/x-jquery-tmpl">
         <li>          
            <a href="#" onclick="searchTrend('${trendUrl}',1,true);" class="trendTopic">${trend}</a>
         </li>
      </script>




      <script id="tweets" type="text/x-jquery-tmpl">
         <li> 
            <img src="${imgSource}" alt="${tweeter}" />          
           <p class="tweeter"><a href="http://twitter.com/intent/user?screen_name=${tweeter}">${tweeter}</a></p> <div id="tweet" class="tweet"> ${tweet} </div>
<div class="tweetFooter">
            <div class="tweettime">${tweettime}</div> 

<div class="twitterActions">
            <div class="twitterAction"><a href="http://twitter.com/intent/retweet?tweet_id=${tweetID}">rt</a></div>

 <div class="twitterAction"><a href="http://twitter.com/intent/tweet?in_reply_to=${tweetID}">reply</a></div>

<div class="twitterAction"><a href="http://twitter.com/intent/favorite?tweet_id=${tweetID}">fav</a></div>
</div>
</div>
         </li>
      </script>

     <div id="alltrends" class="alltrends"> 
          <ul id="trend"></ul> 
      </div>

     <div id="headersearchContaier"><div id="headersearch"><div id="logo"><img src="twitstant.png"/></div><div id="inputbox"><input id="searchbox" size=20 type="text" class="searchbox"/></div> </div></div>



     <div id="alltweets" class="alltweets">
      <ul id="twitter"></ul>
     </div>

     <div id="noresults" class="noresults">
        No search results.
     </div>  

     <div id="footer" class="footer">
        <div id="addthisContainer" class="addThisContainer">
       <!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_stumbleupon_badge" su:badge:style="2"></a>
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e877cf92f81c666"></script>
<!-- AddThis Button END -->
</div>
     </div>






</body>
</html>